package com.ssy.lingxi.common.constant.basic;

import com.ssy.lingxi.common.language.LanguageHolder;

/**
 * 采购合同付款方式枚举
 * @author 万宁
 * @version 2.0.0
 * @date 2021-08-10
 */
public enum PurchaseContractPayTypeEnum {
    /**
     * 现结 - 1
     */
    CASH(1, "现结"),

    /**
     * 账期(按月) - 2
     */
    PERIOD_MONTHLY(2, "账期(按月)"),

    /**
     * 账期(按天) - 3
     */
    PERIOD_DAILY(3, "账期(按天)"),

    /**
     * 月结 - 4
     */
    MONTHLY(4, "月结");

    PurchaseContractPayTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;
    private String name;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.getCode());
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据枚举值获得名称
     * @param code 枚举值
     * @return 名称
     */
    public static String getNameByCode(Integer code) {
        return LanguageHolder.getName(PurchaseContractPayTypeEnum.class, code);
    }
}
